I was trying to build up my meta keyword element in my code and want to include any custom keywords per page and then bolt on some standard ones on the end. I did not want to use a macro as its a bit over kill (and you end up with lots of them) and its a one shot wonder on this site, it won't get used again.
Unless I'm missing something here, you just need to add a text data type your document type with an alias something like 'metaKeywords'
Then create one XSLT file and macro that uses this value and then append your default keywords on the end within the xslt, then insert this macro in your template.
Can I use <%= %> to access umbraco values?
I was trying to build up my meta keyword element in my code and want to include any custom keywords per page and then bolt on some standard ones on the end. I did not want to use a macro as its a bit over kill (and you end up with lots of them) and its a one shot wonder on this site, it won't get used again.
Then I tried using something like this:
<umbraco:Item field="metaKeywords" textIfEmpty="" insertTextBefore="<meta name="keywords" content="" insertTextAfter="my default keywords here" />" case="lower" htmlEncode="true" stripParagraph="true" runat="server"></umbraco:Item>
But I simply find this really counter intuitive and I simply HATE writing element code encoded inside another element, its just all wrong.
So how best to do it. In ASP.net or Class ASP I'd do something like this:
<meta name="keyword" content="<%= page.metaKeywords %> my default keywords here" />
Is this doable? If so how to do you get to the umbraco page object and is there any docs on whats available.
More importantly is this the "umbraco way"? Am I missing a handy shortcut that I can't find in the docs?
Cheers
Pete
Unless I'm missing something here, you just need to add a text data type your document type with an alias something like 'metaKeywords'
Then create one XSLT file and macro that uses this value and then append your default keywords on the end within the xslt, then insert this macro in your template.
Rich
You can use nodefactory to get metaKeywords into variable and then use it as you want, but is similar overkill as macro for me :-)
http://umbraco.org/documentation/books/api-cheatsheet/working-with-the-nodefactory
You can use nodefactory to get metaKeywords into variable and then use it as you want, but is similar overkill as macro for me :-)
http://umbraco.org/documentation/books/api-cheatsheet/working-with-the-nodefactory
Sorry for double posting, but if I don't delete text from url I have BadRequest Invalid URL Error which is caused by % in URL
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.